package com.awa.usercenter.service.impl;

import com.awa.usercenter.common.Code;
import com.awa.usercenter.exception.BusinessException;
import com.awa.usercenter.mapper.AdminAuthMapper;
import com.awa.usercenter.mapper.CompanyAuthMapper;
import com.awa.usercenter.model.domain.AdminAuth;
import com.awa.usercenter.model.domain.CompanyAuth;
import com.awa.usercenter.service.AdminAuthService;
import com.awa.usercenter.service.CompanyAuthService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@Slf4j
public class AdminAuthImpl extends ServiceImpl<AdminAuthMapper, AdminAuth> implements AdminAuthService {
    @Autowired
    AdminAuthMapper adminAuthMapper;

    @Override
    public List<AdminAuth> switchStatus(int status, List<String> datalist) {
        /**
         * status 0 ---- 进行中
         * status 1 ---- 通过
         * status 2 ---- 未通过
         */
        List<AdminAuth> adminAuths = adminAuthMapper.selectBatchIds(datalist);
        for (AdminAuth adminAuth : adminAuths) {
            if(adminAuth!=null){
                adminAuth.setStatus(status);
            }
        }
        updateBatchById(adminAuths);
        return adminAuths;
    }
}




